from utils.api import API
from django.conf.urls import url
from user.forms import *
from user.views import views_login, view_supervisor, view_test

baseUrl = "/api/user/"

registerAPI = API(RegisterForm, method='POST', moduleUrl='register/', urlPrefix=baseUrl)
loginAPI = API(LoginForm, method='POST', moduleUrl='login/', urlPrefix=baseUrl)
logoutAPI = API(LogoutForm, method='POST', moduleUrl='logout/', urlPrefix=baseUrl)
getValidImgAPI = API(GetValidImg, method='POST', moduleUrl='getCode/', urlPrefix=baseUrl)
isOnlineAPI = API(IsOnlineForm, method='POST', moduleUrl='isOnline/', urlPrefix=baseUrl)
isUserSystemAPI = API(IsUserSystemWebForm, method='POST', moduleUrl='isUserSystem/', urlPrefix=baseUrl)
updateTokenAPI = API(updateTokenForm, method='POST', moduleUrl='updateToken/', urlPrefix=baseUrl)

# super
supervisorUserListAPI = API(SupervisorUserListForm, method='POST', moduleUrl='supervisor/userList/', urlPrefix=baseUrl)
supervisorEditAPI = API(SupervisorEditForm, method='POST', moduleUrl='supervisor/edit/', urlPrefix=baseUrl)

# test
searchUserAPI = API(SearchUserForm, method='POST', moduleUrl='searchUser/', urlPrefix=baseUrl)

urlpatterns = [
    url(loginAPI.moduleUrl, views_login.login),
    url(registerAPI.moduleUrl, views_login.register),
    url(logoutAPI.moduleUrl, views_login.logout),
    url(getValidImgAPI.moduleUrl, views_login.get_valid_img),
    url(isOnlineAPI.moduleUrl, views_login.isOnline),
    url(isUserSystemAPI.moduleUrl, views_login.isUserSystemWeb),
    url(updateTokenAPI.moduleUrl, views_login.updateToken),

    # supervisor
    url(supervisorUserListAPI.moduleUrl, view_supervisor.supervisorUserList),
    url(supervisorEditAPI.moduleUrl, view_supervisor.supervisorEdit),

    # test
    url(searchUserAPI.moduleUrl, view_test.searchUser),
]